<% content_for :sub_navbar do %>
  <div class="sub-navbar node-header <%= "node-header-with-node" if node %> hide-ios">
    <div class="container">
      <% if !node.blank? %>
        <div class="title">
          <%= node.name %>
          <span class="total">共有 <%= node.topics_count %> 个讨论主题</span>
          <div class="pull-right">
            <% if node.collapse_summary? %>
              <a class="btn btn-sm btn-default" data-toggle="collapse" href="#node-summary"><i class="fa fa-lightbulb-o"></i> 节点介绍</a>
            <% end %>
            <%= block_node_tag(node) %>
          </div>
        </div>
        <div class="summary<%= ' collapse' if node.collapse_summary? %>" id="node-summary">
          <%= sanitize_markdown node.summary_html %>
        </div>
      <% else %>
        <%= render 'node_selector' %>
        <ul class="filter nav nav-pills">
          <li><a href="#" class="all-nodes" data-toggle="modal" data-target="#node-selector">所有节点 <span class="caret-right"></span></a></li>
          <li class="<%= ' active' if action_name == 'index' %>">
            <a href="<%= main_app.topics_path %>" data-turbolinks-action="replace">默认</a>
          </li>
          <li class="<%= ' active' if action_name == 'excellent' %>">
            <a href="<%= main_app.excellent_topics_path %>" data-turbolinks-action="replace"><i class="fa fa-award"></i> 精华帖</a>
          </li>
          <li class="<%= ' active' if action_name == 'popular' %>">
            <a href="<%= main_app.popular_topics_path %>" data-turbolinks-action="replace">优质帖子</a>
          </li>
          <% if can?(:ban, Topic) %>
            <li class="<%= ' active' if action_name == 'banned' %>">
              <%= link_to('已屏蔽', main_app.banned_topics_path, data: { 'turbolinks-action': 'replace' }) %>
            </li>
          <% end %>
          <% if !mobile? %>
            <li class="<%= ' active' if action_name == 'no_reply' %>">
              <%= link_to('无人问津', main_app.no_reply_topics_path, data: { 'turbolinks-action': 'replace' }) %>
            </li>
            <li class="<%= ' active' if action_name == 'last_reply' %>">
              <%= link_to('最新回复', main_app.last_reply_topics_path, data: { 'turbolinks-action': 'replace' }) %>
            </li>
          <% end %>
          <li class="<%= ' active' if action_name == 'last' %>">
            <%= link_to('最新发布', main_app.last_topics_path, data: { 'turbolinks-action': 'replace' }) %>
          </li>
        </ul>
      <% end %>
    </div>
  </div>
<% end %>
